Open
Conversation
- asyncio.new_event_loop() + set_event_loop() + run_until_complete() replaced with asyncio.Runner (deprecated since 3.12, removal planned for 3.14) - typing.Dict/Set/Tuple/Optional replaced with built-in generics and union syntax (deprecated since 3.9/3.10) - Catch BaseException instead of Exception in scanner thread so CancelledError doesn't silently kill it Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
asyncio.Runnerreplacesasyncio.new_event_loop()+asyncio.set_event_loop()+loop.run_until_complete()+loop.close()in the scanner thread.set_event_loop()is deprecated since Python 3.10 and scheduled for removal in 3.14.asyncio.Runner(introduced in 3.11) is the recommended replacement — it manages loop lifecycle internally and properly registers the loop for the thread, which dbus-fast relies on for signal dispatch.Built-in generic types replace
typing.Dict,typing.Set,typing.Tuple, andtyping.Optional. These typing aliases have been deprecated since Python 3.9 (generics) and 3.10 (union syntax). Thefrom typing import ...line is removed entirely.BaseExceptioncatch replacesExceptionin the scanner thread so thatasyncio.CancelledError(aBaseExceptionsubclass since Python 3.8) doesn't silently kill the thread.Verified on Cerbo GX
Deployed and tested on Cerbo GX (Python 3.12.12, BlueZ 5.72, kernel 6.12.23-venus-5).
The system was experiencing unrelated periodic reboots (load averages 8–10) during testing, so the service was tested across 5 consecutive clean starts. Each run operated without any application errors until the system rebooted.
Total: ~95 minutes cumulative clean runtime, zero application errors.
Verified across all runs:
Connected=1,State=256)Test plan
svc -d/ SIGTERM (scanner thread joins, no stale BlueZ monitors) — not tested due to system instability